Question: For any positive integer $n,$ let $\langle n \rangle$ denote the closest integer to $\sqrt{n}.$  Evaluate
\[\sum_{n = 1}^\infty \frac{2^{\langle n \rangle} + 2^{-\langle n \rangle}}{2^n}.\]
Let $n$ and $k$ be positive integers such that $\langle n \rangle = k.$  Then
\[k - \frac{1}{2} < \sqrt{n} < k + \frac{1}{2},\]or
\[k^2 - k + \frac{1}{4} < n < k^2 + k + \frac{1}{4}.\]Thus, for a given positive integer $k,$ the values of $n$ such that $\langle n \rangle = k$ are $n = k^2 - k + 1,$ $k^2 - k + 2,$ $\dots,$ $k^2 + k.$  Thus, we can re-write the sum as
\begin{align*}
\sum_{n = 1}^\infty \frac{2^{\langle n \rangle} + 2^{-\langle n \rangle}}{2^n} &= \sum_{k = 1}^\infty \sum_{n = k^2 - k + 1}^{k^2 + k} \frac{2^{\langle n \rangle} + 2^{-\langle n \rangle}}{2^n} \\
&= \sum_{k = 1}^\infty (2^k + 2^{-k}) \left( \frac{1}{2^{k^2 - k + 1}} + \frac{1}{2^{k^2 - k + 2}} + \dots + \frac{1}{2^{k^2 + k}} \right) \\
&= \sum_{k = 1}^\infty (2^k + 2^{-k}) \cdot \frac{2^{2k - 1} + 2^{2k - 2} + \dots + 1}{2^{k^2 + k}} \\
&= \sum_{k = 1}^\infty (2^k + 2^{-k}) \cdot \frac{2^{2k} - 1}{2^{k^2 + k}} \\
&= \sum_{k = 1}^\infty (2^{-k^2 + 2k} - 2^{-k^2 - 2k}) \\
&= (2^1 - 2^{-3}) + (2^0 - 2^{-8}) + (2^{-3} - 2^{-15}) + (2^{-8} - 2^{-24}) + \dotsb \\
&= \boxed{3}.
\end{align*}